<!--
 * @Description: 
 * @Author: 【大白菜】2601779853@qq.com
 * @Date: 2025-09-08 14:33:58
 * @LastEditTime: 2025-09-10 09:15:52
 * @LastEditors: 【大白菜】2601779853@qq.com
-->
<template>
  <Layout />
  <FullLoading />
</template>
<script setup>
import Layout from '@/layout/index.vue'
import FullLoading from '@/components/fullLoading/index.vue'
import { onMounted, onBeforeUnmount } from 'vue'
import { useMainStore } from '@/store'
import { useI18n } from 'vue-i18n'
import { useRouter } from 'vue-router'

const { locale } = useI18n()
const mainStore = useMainStore()

const router = useRouter()

const onResize = () => {
    if(window.innerWidth > 1200) {
      mainStore.setMobile(false)
    }else {
      mainStore.setMobile(true)
    }
}

  onMounted(() => {
    
    const lang = localStorage.getItem('lang') || 'en'
    locale.value = lang
    mainStore.setLang(lang)
    const token = localStorage.getItem('token') || ''
    mainStore.setToken(token)
    mainStore.getWebSiteConfig()
    mainStore.getUserBalance()
    mainStore.getUserInfoApi()
    mainStore.onWss()

    onResize()
    window.addEventListener('resize',() => {
        onResize()
    })

  })

onBeforeUnmount(() => {
  if(mainStore.ws) {
    mainStore.onWebSocketUnSub()
    ws.close()
  }
})

</script>
<style scoped lang="scss">
.logo.vue:hover {
  filter: drop-shadow(0 0 2em #42b883aa);
}

</style>
